# package containing hybrid encryption implementations of PQC primitives

package(default_visibility = ["//:__subpackages__"])

licenses(["notice"])

cc_library(
    name = "cecpq2_hybrid_config",
    srcs = ["cecpq2_hybrid_config.cc"],
    hdrs = ["cecpq2_hybrid_config.h"],
    deps = [
        ":cecpq2_aead_hkdf_private_key_manager",
        ":cecpq2_aead_hkdf_public_key_manager",
        "@com_google_absl//absl/base:core_headers",
        "@com_google_absl//absl/strings",
        "@tink_cc//aead:aead_config",
        "@tink_cc//config:tink_fips",
        "@tink_cc//hybrid:hybrid_decrypt_wrapper",
        "@tink_cc//hybrid:hybrid_encrypt_wrapper",
        "@tink_cc//util:status",
    ],
)

cc_library(
    name = "cecpq2_hybrid_key_templates",
    srcs = ["cecpq2_hybrid_key_templates.cc"],
    hdrs = ["cecpq2_hybrid_key_templates.h"],
    deps = [
        "@com_google_absl//absl/strings",
        "@tink_cc//aead:aead_key_templates",
        "@tink_cc//daead:deterministic_aead_key_templates",
        "@tink_cc//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "@tink_cc//proto:common_cc_proto",
        "@tink_cc//proto:tink_cc_proto",
    ],
)

cc_library(
    name = "cecpq2_aead_hkdf_dem_helper",
    srcs = ["cecpq2_aead_hkdf_dem_helper.cc"],
    hdrs = ["cecpq2_aead_hkdf_dem_helper.h"],
    deps = [
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@tink_cc//:aead",
        "@tink_cc//:deterministic_aead",
        "@tink_cc//:hybrid_encrypt",
        "@tink_cc//aead:aes_ctr_hmac_aead_key_manager",
        "@tink_cc//daead/subtle:aead_or_daead",
        "@tink_cc//experimental/pqcrypto/cecpq2/subtle:cecpq2_hkdf_sender_kem_boringssl",
        "@tink_cc//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "@tink_cc//proto:tink_cc_proto",
        "@tink_cc//util:istream_input_stream",
        "@tink_cc//util:statusor",
    ],
)

cc_library(
    name = "cecpq2_aead_hkdf_private_key_manager",
    srcs = ["cecpq2_aead_hkdf_private_key_manager.cc"],
    hdrs = ["cecpq2_aead_hkdf_private_key_manager.h"],
    deps = [
        ":cecpq2_aead_hkdf_public_key_manager",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@tink_cc//:core/key_type_manager",
        "@tink_cc//:core/private_key_type_manager",
        "@tink_cc//:hybrid_decrypt",
        "@tink_cc//experimental/pqcrypto/cecpq2/hybrid/internal:cecpq2_aead_hkdf_hybrid_decrypt",
        "@tink_cc//experimental/pqcrypto/cecpq2/subtle:cecpq2_subtle_boringssl_util",
        "@tink_cc//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "@tink_cc//proto:tink_cc_proto",
        "@tink_cc//subtle:random",
        "@tink_cc//subtle:subtle_util",
        "@tink_cc//util:enums",
        "@tink_cc//util:secret_data",
        "@tink_cc//util:status",
        "@tink_cc//util:statusor",
    ],
)

cc_library(
    name = "cecpq2_aead_hkdf_public_key_manager",
    srcs = ["cecpq2_aead_hkdf_public_key_manager.cc"],
    hdrs = ["cecpq2_aead_hkdf_public_key_manager.h"],
    deps = [
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@tink_cc//:core/key_type_manager",
        "@tink_cc//:hybrid_encrypt",
        "@tink_cc//experimental/pqcrypto/cecpq2/hybrid/internal:cecpq2_aead_hkdf_hybrid_encrypt",
        "@tink_cc//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "@tink_cc//proto:common_cc_proto",
        "@tink_cc//proto:tink_cc_proto",
        "@tink_cc//util:enums",
        "@tink_cc//util:status",
        "@tink_cc//util:statusor",
    ],
)

# tests

cc_test(
    name = "cecpq2_hybrid_config_test",
    size = "small",
    srcs = ["cecpq2_hybrid_config_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":cecpq2_aead_hkdf_private_key_manager",
        ":cecpq2_aead_hkdf_public_key_manager",
        ":cecpq2_hybrid_config",
        ":cecpq2_hybrid_key_templates",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
        "@tink_cc//:hybrid_decrypt",
        "@tink_cc//:hybrid_encrypt",
        "@tink_cc//:keyset_handle",
        "@tink_cc//config:tink_fips",
        "@tink_cc//util:status",
        "@tink_cc//util:test_matchers",
        "@tink_cc//util:test_util",
    ],
)

cc_test(
    name = "cecpq2_hybrid_key_templates_test",
    size = "small",
    srcs = ["cecpq2_hybrid_key_templates_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":cecpq2_aead_hkdf_private_key_manager",
        ":cecpq2_hybrid_config",
        ":cecpq2_hybrid_key_templates",
        "@com_google_googletest//:gtest_main",
        "@tink_cc//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "@tink_cc//util:test_matchers",
    ],
)

cc_test(
    name = "cecpq2_aead_hkdf_dem_helper_test",
    size = "small",
    srcs = ["cecpq2_aead_hkdf_dem_helper_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":cecpq2_aead_hkdf_dem_helper",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
        "@tink_cc//aead:aes_gcm_key_manager",
        "@tink_cc//config:tink_config",
        "@tink_cc//util:secret_data",
        "@tink_cc//util:test_matchers",
        "@tink_cc//util:test_util",
    ],
)

cc_test(
    name = "cecpq2_aead_hkdf_private_key_manager_test",
    srcs = ["cecpq2_aead_hkdf_private_key_manager_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":cecpq2_aead_hkdf_private_key_manager",
        ":cecpq2_aead_hkdf_public_key_manager",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_googletest//:gtest_main",
        "@tink_cc//:core/key_type_manager",
        "@tink_cc//:core/private_key_type_manager",
        "@tink_cc//:hybrid_decrypt",
        "@tink_cc//aead:aead_key_templates",
        "@tink_cc//aead:aes_gcm_key_manager",
        "@tink_cc//experimental/pqcrypto/cecpq2/hybrid/internal:cecpq2_aead_hkdf_hybrid_decrypt",
        "@tink_cc//experimental/pqcrypto/cecpq2/subtle:cecpq2_subtle_boringssl_util",
        "@tink_cc//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "@tink_cc//proto:tink_cc_proto",
        "@tink_cc//subtle:random",
        "@tink_cc//subtle:subtle_util",
        "@tink_cc//util:enums",
        "@tink_cc//util:secret_data",
        "@tink_cc//util:status",
        "@tink_cc//util:statusor",
        "@tink_cc//util:test_matchers",
        "@tink_cc//util:test_util",
    ],
)

cc_test(
    name = "cecpq2_aead_hkdf_public_key_manager_test",
    srcs = ["cecpq2_aead_hkdf_public_key_manager_test.cc"],
    copts = ["-Iexternal/gtest/include"],
    deps = [
        ":cecpq2_aead_hkdf_private_key_manager",
        ":cecpq2_aead_hkdf_public_key_manager",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_googletest//:gtest_main",
        "@tink_cc//:core/key_type_manager",
        "@tink_cc//:hybrid_encrypt",
        "@tink_cc//aead:aead_key_templates",
        "@tink_cc//aead:aes_gcm_key_manager",
        "@tink_cc//experimental/pqcrypto/cecpq2/hybrid/internal:cecpq2_aead_hkdf_hybrid_encrypt",
        "@tink_cc//experimental/pqcrypto/proto:cecpq2_aead_hkdf_cc_proto",
        "@tink_cc//proto:common_cc_proto",
        "@tink_cc//proto:tink_cc_proto",
        "@tink_cc//util:status",
        "@tink_cc//util:statusor",
        "@tink_cc//util:test_matchers",
        "@tink_cc//util:test_util",
    ],
)
